package com.lowcodeai.common.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 响应码枚举
 * 
 * @author LowCodeAI
 * @since 1.0.0
 */
@Getter
@AllArgsConstructor
public enum ResultCode {
    
    // 成功
    SUCCESS(200, "操作成功"),
    
    // 客户端错误 4xx
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    CONFLICT(409, "资源冲突"),
    UNSUPPORTED_MEDIA_TYPE(415, "不支持的媒体类型"),
    TOO_MANY_REQUESTS(429, "请求过于频繁"),
    
    // 服务器错误 5xx
    ERROR(500, "服务器内部错误"),
    NOT_IMPLEMENTED(501, "功能未实现"),
    BAD_GATEWAY(502, "网关错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    GATEWAY_TIMEOUT(504, "网关超时"),
    
    // 业务错误 1000-9999
    USER_NOT_FOUND(1001, "用户不存在"),
    USERNAME_OR_PASSWORD_ERROR(1002, "用户名或密码错误"),
    USER_ALREADY_EXISTS(1003, "用户已存在"),
    ACCOUNT_DISABLED(1004, "账户已禁用"),
    TOKEN_EXPIRED(1005, "令牌已过期"),
    TOKEN_INVALID(1006, "令牌无效"),
    PERMISSION_DENIED(1007, "权限不足"),
    
    // 工作流相关 2000-2999
    WORKFLOW_NOT_FOUND(2001, "工作流不存在"),
    WORKFLOW_ALREADY_EXISTS(2002, "工作流已存在"),
    WORKFLOW_EXECUTION_FAILED(2003, "工作流执行失败"),
    WORKFLOW_NODE_NOT_FOUND(2004, "工作流节点不存在"),
    WORKFLOW_INVALID_CONFIG(2005, "工作流配置无效"),
    
    // AI模型相关 3000-3999
    MODEL_NOT_FOUND(3001, "AI模型不存在"),
    MODEL_UNAVAILABLE(3002, "AI模型不可用"),
    MODEL_CALL_FAILED(3003, "AI模型调用失败"),
    MODEL_RATE_LIMIT(3004, "AI模型调用频率限制"),
    MODEL_QUOTA_EXCEEDED(3005, "AI模型配额超限"),
    
    // RAG相关 4000-4999
    KNOWLEDGE_BASE_NOT_FOUND(4001, "知识库不存在"),
    DOCUMENT_UPLOAD_FAILED(4002, "文档上传失败"),
    DOCUMENT_PROCESSING_FAILED(4003, "文档处理失败"),
    VECTOR_SEARCH_FAILED(4004, "向量搜索失败"),
    EMBEDDING_FAILED(4005, "向量化失败"),
    
    // 插件相关 5000-5999
    PLUGIN_NOT_FOUND(5001, "插件不存在"),
    PLUGIN_LOAD_FAILED(5002, "插件加载失败"),
    PLUGIN_EXECUTION_FAILED(5003, "插件执行失败"),
    PLUGIN_CONFIG_ERROR(5004, "插件配置错误"),
    
    // 文件相关 6000-6999
    FILE_NOT_FOUND(6001, "文件不存在"),
    FILE_UPLOAD_FAILED(6002, "文件上传失败"),
    FILE_DOWNLOAD_FAILED(6003, "文件下载失败"),
    FILE_SIZE_EXCEEDED(6004, "文件大小超限"),
    FILE_TYPE_NOT_SUPPORTED(6005, "文件类型不支持"),
    
    // 系统相关 9000-9999
    SYSTEM_ERROR(9001, "系统错误"),
    DATABASE_ERROR(9002, "数据库错误"),
    REDIS_ERROR(9003, "Redis错误"),
    NETWORK_ERROR(9004, "网络错误"),
    THIRD_PARTY_SERVICE_ERROR(9005, "第三方服务错误");
    
    /**
     * 响应码
     */
    private final Integer code;
    
    /**
     * 响应消息
     */
    private final String message;
} 